<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>

<div id="filter">
        <s:form action="list" cssClass="tableFilter">
            <tr>
                <th colspan="4" class="tableTitle">
                    <h5>Search</h5>
                </th>
            </tr>
            <tr>
                <td>
                      <label>Name:</label>
                </td>
                <td>
                    <s:textfield label="Name" name="name" value="%{name}" theme="simple" />
                </td>
            </tr>
            <tr>
                <td>
                    <label>Surname:</label>
                </td>
                <td>
                    <s:textfield label="Surname" name="surname" value="%{surname}" theme="simple" />
                </td>
            </tr>
            <tr>
                <td>
                    <label>Translation Company:</label>
                </td>
                <td>
                    <s:textfield label="Translation Company" name="translationCompany" value="%{translationCompany}" theme="simple" />
                </td>
            </tr>
            <tr>
                <td>
                    <label>Country:</label>
                </td>
                <td>
                    <s:select label="Country" name="address.country" id="country"
                              headerKey="" headerValue="Choose a Country"
                              list="countries"
                              listKey="country"
                              listValue="country"
                              theme="simple">
                    </s:select>
                </td>
                <td></td>
                <td></td>
            </tr>


            <tr>
                <td colspan="4" class="centeredButtons"><s:submit value="Search" name="filter" theme="simple" onclick="beforeSave()"/>
                    <s:submit action="create" value="New" theme="simple" onclick="resetForms();"/></td>
            </tr>
        </s:form>
    </div>
<s:if test="!list.isEmpty()">
<s:if test="!list.isEmpty()">
    <div id="table_content">
            <table class="paginated-table">
                <thead>
                    <tr>
                        <th>Name</th>
                        <th>Surname</th>
                        <th>Translation Company</th>
                        <th>Country</th>
                        <th>Mobile Phone</th>
                        <th>E-Mail</th>
                        <th></th>
                    </tr>
                </thead>
                <tbody>
                <s:iterator value="list" var="translator">
                    <tr>
                        <th><s:property value="name"/></th>
                        <th><s:property value="surname"/></th>
                        <th><s:property value="translationCompany"/></th>
                        <th><s:property value="address.country"/></th>
                        <th><s:property value="mobilePhone"/></th>
                        <th><s:property value="email"/></th>
                        <th>
                            <s:form action="create" method="POST">
                                <s:hidden value="%{id}" name="editableTranslatorId"/>
                                <a onclick="$(this).closest('form').submit()"><img src="<s:url value="/images/edit.png"/>" title="Edit" alt="Edit"></a></TH>
                            </s:form>
                        </th>
                    </tr>
                </s:iterator>

                <tbody>
            </table>
        <div style="width: 100%;text-align: center" >
            <span class="prev" style="" >Previous</span><span class="next">Next</span>
        </div>

        <script type="text/javascript">
            paginar(10);
        </script>
    </div>
</s:if>
    </s:if>
<script type="text/javascript">
    var list = true;
</script>

<script type="text/javascript">
    $('#translator').css({"color":"#EE5102","fontWeight":"bold"});
</script>
